#pragma once

#include "../umlmodel_global.h"

#include <memory>
#include <vector>

#include "ParameterableElement.h"
#include "TypedElement.h"

using std::make_shared;
using std::shared_ptr;
using std::vector;

namespace uml {
class ConnectableElementTemplateParameter;
class ConnectorEnd;

/// <summary>
/// ConnectableElement
/// ConnectableElement is an abstract metaclass representing a set of instances that
/// play roles of a StructuredClassifier. ConnectableElements may be joined by
/// attached Connectors and specify configurations of linked instances to be created
/// within an instance of the containing StructuredClassifier.
/// </summary>
class UMLMODEL_EXPORT ConnectableElement : public ParameterableElement, public TypedElement {

public: // JsonSerializable override
    void fromJson(const QJsonObject& json, QStringList& errorList) override;
    void toJson(QJsonObject& json) override;

public: // Methods
public: // Properties
    /// <summary>
    /// ends getter
    /// A set of ConnectorEnds that attach to this ConnectableElement.
    /// </summary>
    vector<shared_ptr<ConnectorEnd>>& ends();

    /// <summary>
    /// templateParameter getter
    /// The ConnectableElementTemplateParameter for this ConnectableElement parameter.
    /// </summary>
    shared_ptr<ConnectableElementTemplateParameter> templateParameter() const;

    /// <summary>
    /// templateParameter setter
    /// The ConnectableElementTemplateParameter for this ConnectableElement parameter.
    /// </summary>
    void setTemplateParameter(shared_ptr<ConnectableElementTemplateParameter> value);

private: // Fields
    /// <summary>
    /// ends
    /// A set of ConnectorEnds that attach to this ConnectableElement.
    /// </summary>
    vector<shared_ptr<ConnectorEnd>> ends_;

    /// <summary>
    /// templateParameter
    /// The ConnectableElementTemplateParameter for this ConnectableElement parameter.
    /// </summary>
    shared_ptr<ConnectableElementTemplateParameter> templateParameter_;

};

} // namespace uml
